{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 导入库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import efinance as ef"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 使用例子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 获取可转债日 K 线数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>债券名称</th>\n",
       "      <th>债券代码</th>\n",
       "      <th>日期</th>\n",
       "      <th>开盘</th>\n",
       "      <th>收盘</th>\n",
       "      <th>最高</th>\n",
       "      <th>最低</th>\n",
       "      <th>成交量</th>\n",
       "      <th>成交额</th>\n",
       "      <th>振幅</th>\n",
       "      <th>涨跌幅</th>\n",
       "      <th>涨跌额</th>\n",
       "      <th>换手率</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-23</td>\n",
       "      <td>130.000</td>\n",
       "      <td>130.000</td>\n",
       "      <td>130.000</td>\n",
       "      <td>130.000</td>\n",
       "      <td>1836427</td>\n",
       "      <td>2.387355e+09</td>\n",
       "      <td>0.00</td>\n",
       "      <td>30.00</td>\n",
       "      <td>30.000</td>\n",
       "      <td>11.62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-26</td>\n",
       "      <td>130.353</td>\n",
       "      <td>130.010</td>\n",
       "      <td>133.880</td>\n",
       "      <td>125.110</td>\n",
       "      <td>8610944</td>\n",
       "      <td>1.126033e+10</td>\n",
       "      <td>6.75</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.010</td>\n",
       "      <td>54.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-27</td>\n",
       "      <td>129.000</td>\n",
       "      <td>129.600</td>\n",
       "      <td>130.846</td>\n",
       "      <td>128.400</td>\n",
       "      <td>1820766</td>\n",
       "      <td>2.357472e+09</td>\n",
       "      <td>1.88</td>\n",
       "      <td>-0.32</td>\n",
       "      <td>-0.410</td>\n",
       "      <td>11.52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-28</td>\n",
       "      <td>129.100</td>\n",
       "      <td>130.770</td>\n",
       "      <td>131.663</td>\n",
       "      <td>128.903</td>\n",
       "      <td>1467727</td>\n",
       "      <td>1.921641e+09</td>\n",
       "      <td>2.13</td>\n",
       "      <td>0.90</td>\n",
       "      <td>1.170</td>\n",
       "      <td>9.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-29</td>\n",
       "      <td>130.690</td>\n",
       "      <td>131.208</td>\n",
       "      <td>133.150</td>\n",
       "      <td>130.560</td>\n",
       "      <td>1156934</td>\n",
       "      <td>1.525974e+09</td>\n",
       "      <td>1.98</td>\n",
       "      <td>0.33</td>\n",
       "      <td>0.438</td>\n",
       "      <td>7.32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-09</td>\n",
       "      <td>159.600</td>\n",
       "      <td>159.300</td>\n",
       "      <td>162.990</td>\n",
       "      <td>158.690</td>\n",
       "      <td>596124</td>\n",
       "      <td>9.585751e+08</td>\n",
       "      <td>2.69</td>\n",
       "      <td>-0.34</td>\n",
       "      <td>-0.550</td>\n",
       "      <td>3.77</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-10</td>\n",
       "      <td>159.190</td>\n",
       "      <td>160.950</td>\n",
       "      <td>161.450</td>\n",
       "      <td>157.000</td>\n",
       "      <td>517237</td>\n",
       "      <td>8.234596e+08</td>\n",
       "      <td>2.79</td>\n",
       "      <td>1.04</td>\n",
       "      <td>1.650</td>\n",
       "      <td>3.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-11</td>\n",
       "      <td>161.110</td>\n",
       "      <td>159.850</td>\n",
       "      <td>162.300</td>\n",
       "      <td>159.400</td>\n",
       "      <td>298906</td>\n",
       "      <td>4.800711e+08</td>\n",
       "      <td>1.80</td>\n",
       "      <td>-0.68</td>\n",
       "      <td>-1.100</td>\n",
       "      <td>1.89</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-12</td>\n",
       "      <td>159.110</td>\n",
       "      <td>158.290</td>\n",
       "      <td>160.368</td>\n",
       "      <td>158.010</td>\n",
       "      <td>270641</td>\n",
       "      <td>4.298100e+08</td>\n",
       "      <td>1.48</td>\n",
       "      <td>-0.98</td>\n",
       "      <td>-1.560</td>\n",
       "      <td>1.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13</td>\n",
       "      <td>158.000</td>\n",
       "      <td>158.358</td>\n",
       "      <td>160.290</td>\n",
       "      <td>157.850</td>\n",
       "      <td>250059</td>\n",
       "      <td>3.975513e+08</td>\n",
       "      <td>1.54</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.068</td>\n",
       "      <td>1.58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>77 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    债券名称    债券代码          日期       开盘       收盘       最高       最低      成交量  \\\n",
       "0   东财转3  123111  2021-04-23  130.000  130.000  130.000  130.000  1836427   \n",
       "1   东财转3  123111  2021-04-26  130.353  130.010  133.880  125.110  8610944   \n",
       "2   东财转3  123111  2021-04-27  129.000  129.600  130.846  128.400  1820766   \n",
       "3   东财转3  123111  2021-04-28  129.100  130.770  131.663  128.903  1467727   \n",
       "4   东财转3  123111  2021-04-29  130.690  131.208  133.150  130.560  1156934   \n",
       "..   ...     ...         ...      ...      ...      ...      ...      ...   \n",
       "72  东财转3  123111  2021-08-09  159.600  159.300  162.990  158.690   596124   \n",
       "73  东财转3  123111  2021-08-10  159.190  160.950  161.450  157.000   517237   \n",
       "74  东财转3  123111  2021-08-11  161.110  159.850  162.300  159.400   298906   \n",
       "75  东财转3  123111  2021-08-12  159.110  158.290  160.368  158.010   270641   \n",
       "76  东财转3  123111  2021-08-13  158.000  158.358  160.290  157.850   250059   \n",
       "\n",
       "             成交额    振幅    涨跌幅     涨跌额    换手率  \n",
       "0   2.387355e+09  0.00  30.00  30.000  11.62  \n",
       "1   1.126033e+10  6.75   0.01   0.010  54.50  \n",
       "2   2.357472e+09  1.88  -0.32  -0.410  11.52  \n",
       "3   1.921641e+09  2.13   0.90   1.170   9.29  \n",
       "4   1.525974e+09  1.98   0.33   0.438   7.32  \n",
       "..           ...   ...    ...     ...    ...  \n",
       "72  9.585751e+08  2.69  -0.34  -0.550   3.77  \n",
       "73  8.234596e+08  2.79   1.04   1.650   3.27  \n",
       "74  4.800711e+08  1.80  -0.68  -1.100   1.89  \n",
       "75  4.298100e+08  1.48  -0.98  -1.560   1.71  \n",
       "76  3.975513e+08  1.54   0.04   0.068   1.58  \n",
       "\n",
       "[77 rows x 13 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可转债代码（以 东财转3 为例）\n",
    "bond_code = '123111'\n",
    "ef.bond.get_quote_history(bond_code)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 获取可转债 5 分钟 K 线数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>债券名称</th>\n",
       "      <th>债券代码</th>\n",
       "      <th>日期</th>\n",
       "      <th>开盘</th>\n",
       "      <th>收盘</th>\n",
       "      <th>最高</th>\n",
       "      <th>最低</th>\n",
       "      <th>成交量</th>\n",
       "      <th>成交额</th>\n",
       "      <th>振幅</th>\n",
       "      <th>涨跌幅</th>\n",
       "      <th>涨跌额</th>\n",
       "      <th>换手率</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-07-01 09:35</td>\n",
       "      <td>149.000</td>\n",
       "      <td>147.254</td>\n",
       "      <td>149.980</td>\n",
       "      <td>147.216</td>\n",
       "      <td>66243</td>\n",
       "      <td>98742494.0</td>\n",
       "      <td>1.89</td>\n",
       "      <td>0.58</td>\n",
       "      <td>0.854</td>\n",
       "      <td>0.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-07-01 09:40</td>\n",
       "      <td>147.200</td>\n",
       "      <td>146.820</td>\n",
       "      <td>147.585</td>\n",
       "      <td>146.600</td>\n",
       "      <td>29413</td>\n",
       "      <td>43275757.0</td>\n",
       "      <td>0.67</td>\n",
       "      <td>-0.29</td>\n",
       "      <td>-0.434</td>\n",
       "      <td>0.19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-07-01 09:45</td>\n",
       "      <td>146.680</td>\n",
       "      <td>145.330</td>\n",
       "      <td>146.801</td>\n",
       "      <td>145.050</td>\n",
       "      <td>24517</td>\n",
       "      <td>35850633.0</td>\n",
       "      <td>1.19</td>\n",
       "      <td>-1.01</td>\n",
       "      <td>-1.490</td>\n",
       "      <td>0.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-07-01 09:50</td>\n",
       "      <td>145.400</td>\n",
       "      <td>144.829</td>\n",
       "      <td>145.900</td>\n",
       "      <td>144.680</td>\n",
       "      <td>23712</td>\n",
       "      <td>34446854.0</td>\n",
       "      <td>0.84</td>\n",
       "      <td>-0.34</td>\n",
       "      <td>-0.501</td>\n",
       "      <td>0.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-07-01 09:55</td>\n",
       "      <td>144.892</td>\n",
       "      <td>145.260</td>\n",
       "      <td>145.542</td>\n",
       "      <td>144.734</td>\n",
       "      <td>14692</td>\n",
       "      <td>21310444.0</td>\n",
       "      <td>0.56</td>\n",
       "      <td>0.30</td>\n",
       "      <td>0.431</td>\n",
       "      <td>0.09</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1531</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13 14:40</td>\n",
       "      <td>158.693</td>\n",
       "      <td>158.400</td>\n",
       "      <td>158.693</td>\n",
       "      <td>158.399</td>\n",
       "      <td>4281</td>\n",
       "      <td>6789132.0</td>\n",
       "      <td>0.19</td>\n",
       "      <td>-0.18</td>\n",
       "      <td>-0.293</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1532</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13 14:45</td>\n",
       "      <td>158.400</td>\n",
       "      <td>158.315</td>\n",
       "      <td>158.400</td>\n",
       "      <td>158.275</td>\n",
       "      <td>1554</td>\n",
       "      <td>2459474.0</td>\n",
       "      <td>0.08</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>-0.085</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1533</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13 14:50</td>\n",
       "      <td>158.301</td>\n",
       "      <td>158.290</td>\n",
       "      <td>158.380</td>\n",
       "      <td>158.250</td>\n",
       "      <td>1593</td>\n",
       "      <td>2522199.0</td>\n",
       "      <td>0.08</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>-0.025</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1534</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13 14:55</td>\n",
       "      <td>158.270</td>\n",
       "      <td>158.456</td>\n",
       "      <td>158.580</td>\n",
       "      <td>158.270</td>\n",
       "      <td>4058</td>\n",
       "      <td>6428796.0</td>\n",
       "      <td>0.20</td>\n",
       "      <td>0.10</td>\n",
       "      <td>0.166</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1535</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13 15:00</td>\n",
       "      <td>158.460</td>\n",
       "      <td>158.358</td>\n",
       "      <td>158.490</td>\n",
       "      <td>158.200</td>\n",
       "      <td>4704</td>\n",
       "      <td>7449761.0</td>\n",
       "      <td>0.18</td>\n",
       "      <td>-0.06</td>\n",
       "      <td>-0.098</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1536 rows × 13 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      债券名称    债券代码                日期       开盘       收盘       最高       最低  \\\n",
       "0     东财转3  123111  2021-07-01 09:35  149.000  147.254  149.980  147.216   \n",
       "1     东财转3  123111  2021-07-01 09:40  147.200  146.820  147.585  146.600   \n",
       "2     东财转3  123111  2021-07-01 09:45  146.680  145.330  146.801  145.050   \n",
       "3     东财转3  123111  2021-07-01 09:50  145.400  144.829  145.900  144.680   \n",
       "4     东财转3  123111  2021-07-01 09:55  144.892  145.260  145.542  144.734   \n",
       "...    ...     ...               ...      ...      ...      ...      ...   \n",
       "1531  东财转3  123111  2021-08-13 14:40  158.693  158.400  158.693  158.399   \n",
       "1532  东财转3  123111  2021-08-13 14:45  158.400  158.315  158.400  158.275   \n",
       "1533  东财转3  123111  2021-08-13 14:50  158.301  158.290  158.380  158.250   \n",
       "1534  东财转3  123111  2021-08-13 14:55  158.270  158.456  158.580  158.270   \n",
       "1535  东财转3  123111  2021-08-13 15:00  158.460  158.358  158.490  158.200   \n",
       "\n",
       "        成交量         成交额    振幅   涨跌幅    涨跌额   换手率  \n",
       "0     66243  98742494.0  1.89  0.58  0.854  0.42  \n",
       "1     29413  43275757.0  0.67 -0.29 -0.434  0.19  \n",
       "2     24517  35850633.0  1.19 -1.01 -1.490  0.16  \n",
       "3     23712  34446854.0  0.84 -0.34 -0.501  0.15  \n",
       "4     14692  21310444.0  0.56  0.30  0.431  0.09  \n",
       "...     ...         ...   ...   ...    ...   ...  \n",
       "1531   4281   6789132.0  0.19 -0.18 -0.293  0.03  \n",
       "1532   1554   2459474.0  0.08 -0.05 -0.085  0.01  \n",
       "1533   1593   2522199.0  0.08 -0.02 -0.025  0.01  \n",
       "1534   4058   6428796.0  0.20  0.10  0.166  0.03  \n",
       "1535   4704   7449761.0  0.18 -0.06 -0.098  0.03  \n",
       "\n",
       "[1536 rows x 13 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 可转债代码（以 东财转3 为例）\n",
    "bond_code = '123111'\n",
    "# 5 分钟\n",
    "frequency = 5\n",
    "ef.bond.get_quote_history(bond_code, klt=frequency)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 全部可转债发行信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>债券代码</th>\n",
       "      <th>债券名称</th>\n",
       "      <th>正股代码</th>\n",
       "      <th>正股名称</th>\n",
       "      <th>债券评级</th>\n",
       "      <th>申购日期</th>\n",
       "      <th>发行规模(亿)</th>\n",
       "      <th>网上发行中签率(%)</th>\n",
       "      <th>上市日期</th>\n",
       "      <th>到期日期</th>\n",
       "      <th>期限(年)</th>\n",
       "      <th>利率说明</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>127045</td>\n",
       "      <td>牧原转债</td>\n",
       "      <td>002714</td>\n",
       "      <td>牧原股份</td>\n",
       "      <td>AA+</td>\n",
       "      <td>2021-08-16 00:00:00</td>\n",
       "      <td>95.5000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>None</td>\n",
       "      <td>2027-08-16 00:00:00</td>\n",
       "      <td>6</td>\n",
       "      <td>第一年0.20%、第二年0.40%、第三年0.80%、第四年1.20%、第五年1.50%、第...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>127044</td>\n",
       "      <td>蒙娜转债</td>\n",
       "      <td>002918</td>\n",
       "      <td>蒙娜丽莎</td>\n",
       "      <td>AA</td>\n",
       "      <td>2021-08-16 00:00:00</td>\n",
       "      <td>11.6893</td>\n",
       "      <td>NaN</td>\n",
       "      <td>None</td>\n",
       "      <td>2027-08-16 00:00:00</td>\n",
       "      <td>6</td>\n",
       "      <td>第一年为0.30%、第二年为0.50%、第三年为1.00%、第四年为1.50%、第五年为1....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>123124</td>\n",
       "      <td>晶瑞转2</td>\n",
       "      <td>300655</td>\n",
       "      <td>晶瑞电材</td>\n",
       "      <td>A+</td>\n",
       "      <td>2021-08-16 00:00:00</td>\n",
       "      <td>5.2300</td>\n",
       "      <td>NaN</td>\n",
       "      <td>None</td>\n",
       "      <td>2027-08-16 00:00:00</td>\n",
       "      <td>6</td>\n",
       "      <td>第一年0.2%,第二年0.3%,第三年0.4%,第四年1.5%,第五年1.8%,第六年2%。</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>118002</td>\n",
       "      <td>天合转债</td>\n",
       "      <td>688599</td>\n",
       "      <td>天合光能</td>\n",
       "      <td>AA</td>\n",
       "      <td>2021-08-13 00:00:00</td>\n",
       "      <td>52.5200</td>\n",
       "      <td>0.010599</td>\n",
       "      <td>None</td>\n",
       "      <td>2027-08-13 00:00:00</td>\n",
       "      <td>6</td>\n",
       "      <td>本次发行的可转债票面利率为第一年0.30%,第二年0.50%,第三年1.00%,第四年1.5...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>123123</td>\n",
       "      <td>江丰转债</td>\n",
       "      <td>300666</td>\n",
       "      <td>江丰电子</td>\n",
       "      <td>A+</td>\n",
       "      <td>2021-08-12 00:00:00</td>\n",
       "      <td>5.1650</td>\n",
       "      <td>0.003348</td>\n",
       "      <td>None</td>\n",
       "      <td>2027-08-12 00:00:00</td>\n",
       "      <td>6</td>\n",
       "      <td>第一年为0.40%、第二年为0.60%、第三年为1.20%、第四年为1.80%、第五年为2....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>89</th>\n",
       "      <td>110227</td>\n",
       "      <td>赤化转债</td>\n",
       "      <td>600227</td>\n",
       "      <td>圣济堂</td>\n",
       "      <td>AAA</td>\n",
       "      <td>2007-10-10 00:00:00</td>\n",
       "      <td>4.5000</td>\n",
       "      <td>0.158854</td>\n",
       "      <td>2007-10-23 00:00:00</td>\n",
       "      <td>2009-05-25 00:00:00</td>\n",
       "      <td>1.6192</td>\n",
       "      <td>票面利率和付息日期:本次发行的可转债票面利率第一年为1.5%、第二年为1.8%、第三年为2....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90</th>\n",
       "      <td>126006</td>\n",
       "      <td>07深高债</td>\n",
       "      <td>600548</td>\n",
       "      <td>深高速</td>\n",
       "      <td>AAA</td>\n",
       "      <td>2007-10-09 00:00:00</td>\n",
       "      <td>15.0000</td>\n",
       "      <td>0.290304</td>\n",
       "      <td>2007-10-30 00:00:00</td>\n",
       "      <td>2013-10-09 00:00:00</td>\n",
       "      <td>6</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>110971</td>\n",
       "      <td>恒源转债</td>\n",
       "      <td>600971</td>\n",
       "      <td>恒源煤电</td>\n",
       "      <td>AAA</td>\n",
       "      <td>2007-09-24 00:00:00</td>\n",
       "      <td>4.0000</td>\n",
       "      <td>5.311774</td>\n",
       "      <td>2007-10-12 00:00:00</td>\n",
       "      <td>2009-12-21 00:00:00</td>\n",
       "      <td>2.2484</td>\n",
       "      <td>票面利率为:第一年年利率1.5%,第二年年利率1.8%,第三年年利率2.1%,第四年年利率2...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>110567</td>\n",
       "      <td>山鹰转债</td>\n",
       "      <td>600567</td>\n",
       "      <td>山鹰国际</td>\n",
       "      <td>AA</td>\n",
       "      <td>2007-09-05 00:00:00</td>\n",
       "      <td>4.7000</td>\n",
       "      <td>0.496391</td>\n",
       "      <td>2007-09-17 00:00:00</td>\n",
       "      <td>2010-02-01 00:00:00</td>\n",
       "      <td>2.4055</td>\n",
       "      <td>票面利率和付息日期:本次发行的可转债票面利率第一年为1.4%,第二年为1.7%,第三年为2....</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>110026</td>\n",
       "      <td>中海转债</td>\n",
       "      <td>600026</td>\n",
       "      <td>中远海能</td>\n",
       "      <td>AAA</td>\n",
       "      <td>2007-07-02 00:00:00</td>\n",
       "      <td>20.0000</td>\n",
       "      <td>1.333453</td>\n",
       "      <td>2007-07-12 00:00:00</td>\n",
       "      <td>2008-03-27 00:00:00</td>\n",
       "      <td>0.737</td>\n",
       "      <td>票面利率:第一年为1.84%,第二年为2.05%,第三年为2.26%,第四年为2.47%,第...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>594 rows × 12 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      债券代码   债券名称    正股代码  正股名称 债券评级                 申购日期  发行规模(亿)  \\\n",
       "0   127045   牧原转债  002714  牧原股份  AA+  2021-08-16 00:00:00  95.5000   \n",
       "1   127044   蒙娜转债  002918  蒙娜丽莎   AA  2021-08-16 00:00:00  11.6893   \n",
       "2   123124   晶瑞转2  300655  晶瑞电材   A+  2021-08-16 00:00:00   5.2300   \n",
       "3   118002   天合转债  688599  天合光能   AA  2021-08-13 00:00:00  52.5200   \n",
       "4   123123   江丰转债  300666  江丰电子   A+  2021-08-12 00:00:00   5.1650   \n",
       "..     ...    ...     ...   ...  ...                  ...      ...   \n",
       "89  110227   赤化转债  600227   圣济堂  AAA  2007-10-10 00:00:00   4.5000   \n",
       "90  126006  07深高债  600548   深高速  AAA  2007-10-09 00:00:00  15.0000   \n",
       "91  110971   恒源转债  600971  恒源煤电  AAA  2007-09-24 00:00:00   4.0000   \n",
       "92  110567   山鹰转债  600567  山鹰国际   AA  2007-09-05 00:00:00   4.7000   \n",
       "93  110026   中海转债  600026  中远海能  AAA  2007-07-02 00:00:00  20.0000   \n",
       "\n",
       "    网上发行中签率(%)                 上市日期                 到期日期   期限(年)  \\\n",
       "0          NaN                 None  2027-08-16 00:00:00       6   \n",
       "1          NaN                 None  2027-08-16 00:00:00       6   \n",
       "2          NaN                 None  2027-08-16 00:00:00       6   \n",
       "3     0.010599                 None  2027-08-13 00:00:00       6   \n",
       "4     0.003348                 None  2027-08-12 00:00:00       6   \n",
       "..         ...                  ...                  ...     ...   \n",
       "89    0.158854  2007-10-23 00:00:00  2009-05-25 00:00:00  1.6192   \n",
       "90    0.290304  2007-10-30 00:00:00  2013-10-09 00:00:00       6   \n",
       "91    5.311774  2007-10-12 00:00:00  2009-12-21 00:00:00  2.2484   \n",
       "92    0.496391  2007-09-17 00:00:00  2010-02-01 00:00:00  2.4055   \n",
       "93    1.333453  2007-07-12 00:00:00  2008-03-27 00:00:00   0.737   \n",
       "\n",
       "                                                 利率说明  \n",
       "0   第一年0.20%、第二年0.40%、第三年0.80%、第四年1.20%、第五年1.50%、第...  \n",
       "1   第一年为0.30%、第二年为0.50%、第三年为1.00%、第四年为1.50%、第五年为1....  \n",
       "2      第一年0.2%,第二年0.3%,第三年0.4%,第四年1.5%,第五年1.8%,第六年2%。  \n",
       "3   本次发行的可转债票面利率为第一年0.30%,第二年0.50%,第三年1.00%,第四年1.5...  \n",
       "4   第一年为0.40%、第二年为0.60%、第三年为1.20%、第四年为1.80%、第五年为2....  \n",
       "..                                                ...  \n",
       "89  票面利率和付息日期:本次发行的可转债票面利率第一年为1.5%、第二年为1.8%、第三年为2....  \n",
       "90                                               None  \n",
       "91  票面利率为:第一年年利率1.5%,第二年年利率1.8%,第三年年利率2.1%,第四年年利率2...  \n",
       "92  票面利率和付息日期:本次发行的可转债票面利率第一年为1.4%,第二年为1.7%,第三年为2....  \n",
       "93  票面利率:第一年为1.84%,第二年为2.05%,第三年为2.26%,第四年为2.47%,第...  \n",
       "\n",
       "[594 rows x 12 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ef.bond.get_all_base_info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 可转债整体行情"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>债券代码</th>\n",
       "      <th>债券名称</th>\n",
       "      <th>市场编号</th>\n",
       "      <th>涨跌幅</th>\n",
       "      <th>最新价</th>\n",
       "      <th>最高</th>\n",
       "      <th>最低</th>\n",
       "      <th>今开</th>\n",
       "      <th>涨跌额</th>\n",
       "      <th>换手率</th>\n",
       "      <th>量比</th>\n",
       "      <th>动态市盈率</th>\n",
       "      <th>成交量</th>\n",
       "      <th>成交额</th>\n",
       "      <th>昨日收盘</th>\n",
       "      <th>总市值</th>\n",
       "      <th>流通市值</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>123051</td>\n",
       "      <td>今天转债</td>\n",
       "      <td>0</td>\n",
       "      <td>24.03</td>\n",
       "      <td>158.66</td>\n",
       "      <td>165.0</td>\n",
       "      <td>134.0</td>\n",
       "      <td>134.0</td>\n",
       "      <td>30.74</td>\n",
       "      <td>496.74</td>\n",
       "      <td>67.16</td>\n",
       "      <td>-</td>\n",
       "      <td>1388341</td>\n",
       "      <td>2185911136.0</td>\n",
       "      <td>127.92</td>\n",
       "      <td>443443594</td>\n",
       "      <td>443443594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>123042</td>\n",
       "      <td>银河转债</td>\n",
       "      <td>0</td>\n",
       "      <td>16.04</td>\n",
       "      <td>219.309</td>\n",
       "      <td>224.0</td>\n",
       "      <td>193.11</td>\n",
       "      <td>194.5</td>\n",
       "      <td>30.309</td>\n",
       "      <td>1833.99</td>\n",
       "      <td>1.34</td>\n",
       "      <td>-</td>\n",
       "      <td>3042265</td>\n",
       "      <td>6402014720.0</td>\n",
       "      <td>189.0</td>\n",
       "      <td>363794813</td>\n",
       "      <td>363794813</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>113034</td>\n",
       "      <td>滨化转债</td>\n",
       "      <td>1</td>\n",
       "      <td>13.49</td>\n",
       "      <td>247.71</td>\n",
       "      <td>255.62</td>\n",
       "      <td>214.5</td>\n",
       "      <td>214.5</td>\n",
       "      <td>29.45</td>\n",
       "      <td>334.56</td>\n",
       "      <td>2.96</td>\n",
       "      <td>-</td>\n",
       "      <td>1585993</td>\n",
       "      <td>3798255024.0</td>\n",
       "      <td>218.26</td>\n",
       "      <td>1174284861</td>\n",
       "      <td>1174284861</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>128064</td>\n",
       "      <td>司尔转债</td>\n",
       "      <td>0</td>\n",
       "      <td>11.29</td>\n",
       "      <td>148.01</td>\n",
       "      <td>150.34</td>\n",
       "      <td>133.007</td>\n",
       "      <td>133.73</td>\n",
       "      <td>15.01</td>\n",
       "      <td>277.06</td>\n",
       "      <td>7.04</td>\n",
       "      <td>-</td>\n",
       "      <td>887301</td>\n",
       "      <td>1305800336.0</td>\n",
       "      <td>133.0</td>\n",
       "      <td>474009426</td>\n",
       "      <td>474009426</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>113027</td>\n",
       "      <td>华钰转债</td>\n",
       "      <td>1</td>\n",
       "      <td>8.38</td>\n",
       "      <td>129.86</td>\n",
       "      <td>130.2</td>\n",
       "      <td>122.3</td>\n",
       "      <td>123.0</td>\n",
       "      <td>10.04</td>\n",
       "      <td>83.84</td>\n",
       "      <td>4.15</td>\n",
       "      <td>-</td>\n",
       "      <td>272641</td>\n",
       "      <td>346817120.0</td>\n",
       "      <td>119.82</td>\n",
       "      <td>422273164</td>\n",
       "      <td>422273164</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>390</th>\n",
       "      <td>113621</td>\n",
       "      <td>彤程转债</td>\n",
       "      <td>1</td>\n",
       "      <td>-4.45</td>\n",
       "      <td>188.57</td>\n",
       "      <td>198.22</td>\n",
       "      <td>188.0</td>\n",
       "      <td>196.01</td>\n",
       "      <td>-8.79</td>\n",
       "      <td>29.91</td>\n",
       "      <td>0.47</td>\n",
       "      <td>-</td>\n",
       "      <td>168709</td>\n",
       "      <td>326018848.0</td>\n",
       "      <td>197.36</td>\n",
       "      <td>1063693010</td>\n",
       "      <td>1063693010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>391</th>\n",
       "      <td>128017</td>\n",
       "      <td>金禾转债</td>\n",
       "      <td>0</td>\n",
       "      <td>-4.86</td>\n",
       "      <td>182.676</td>\n",
       "      <td>204.989</td>\n",
       "      <td>182.61</td>\n",
       "      <td>195.16</td>\n",
       "      <td>-9.324</td>\n",
       "      <td>35.58</td>\n",
       "      <td>2.0</td>\n",
       "      <td>-</td>\n",
       "      <td>196375</td>\n",
       "      <td>375750768.0</td>\n",
       "      <td>192.0</td>\n",
       "      <td>1008366222</td>\n",
       "      <td>1008366222</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>392</th>\n",
       "      <td>113548</td>\n",
       "      <td>石英转债</td>\n",
       "      <td>1</td>\n",
       "      <td>-5.16</td>\n",
       "      <td>250.22</td>\n",
       "      <td>267.57</td>\n",
       "      <td>246.56</td>\n",
       "      <td>262.3</td>\n",
       "      <td>-13.61</td>\n",
       "      <td>143.32</td>\n",
       "      <td>0.72</td>\n",
       "      <td>-</td>\n",
       "      <td>175893</td>\n",
       "      <td>452796304.0</td>\n",
       "      <td>263.83</td>\n",
       "      <td>307086749</td>\n",
       "      <td>307086749</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>393</th>\n",
       "      <td>128093</td>\n",
       "      <td>百川转债</td>\n",
       "      <td>0</td>\n",
       "      <td>-5.71</td>\n",
       "      <td>429.042</td>\n",
       "      <td>449.97</td>\n",
       "      <td>426.078</td>\n",
       "      <td>443.1</td>\n",
       "      <td>-25.958</td>\n",
       "      <td>426.86</td>\n",
       "      <td>0.36</td>\n",
       "      <td>-</td>\n",
       "      <td>693261</td>\n",
       "      <td>3032643232.0</td>\n",
       "      <td>455.0</td>\n",
       "      <td>696810974</td>\n",
       "      <td>696810974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>394</th>\n",
       "      <td>123066</td>\n",
       "      <td>赛意转债</td>\n",
       "      <td>0</td>\n",
       "      <td>-6.0</td>\n",
       "      <td>193.08</td>\n",
       "      <td>203.999</td>\n",
       "      <td>193.08</td>\n",
       "      <td>203.0</td>\n",
       "      <td>-12.32</td>\n",
       "      <td>323.13</td>\n",
       "      <td>0.22</td>\n",
       "      <td>-</td>\n",
       "      <td>133317</td>\n",
       "      <td>261546032.0</td>\n",
       "      <td>205.4</td>\n",
       "      <td>79660753</td>\n",
       "      <td>79660753</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>395 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       债券代码  债券名称  市场编号    涨跌幅      最新价       最高       最低      今开     涨跌额  \\\n",
       "0    123051  今天转债     0  24.03   158.66    165.0    134.0   134.0   30.74   \n",
       "1    123042  银河转债     0  16.04  219.309    224.0   193.11   194.5  30.309   \n",
       "2    113034  滨化转债     1  13.49   247.71   255.62    214.5   214.5   29.45   \n",
       "3    128064  司尔转债     0  11.29   148.01   150.34  133.007  133.73   15.01   \n",
       "4    113027  华钰转债     1   8.38   129.86    130.2    122.3   123.0   10.04   \n",
       "..      ...   ...   ...    ...      ...      ...      ...     ...     ...   \n",
       "390  113621  彤程转债     1  -4.45   188.57   198.22    188.0  196.01   -8.79   \n",
       "391  128017  金禾转债     0  -4.86  182.676  204.989   182.61  195.16  -9.324   \n",
       "392  113548  石英转债     1  -5.16   250.22   267.57   246.56   262.3  -13.61   \n",
       "393  128093  百川转债     0  -5.71  429.042   449.97  426.078   443.1 -25.958   \n",
       "394  123066  赛意转债     0   -6.0   193.08  203.999   193.08   203.0  -12.32   \n",
       "\n",
       "         换手率     量比 动态市盈率      成交量           成交额    昨日收盘         总市值  \\\n",
       "0     496.74  67.16     -  1388341  2185911136.0  127.92   443443594   \n",
       "1    1833.99   1.34     -  3042265  6402014720.0   189.0   363794813   \n",
       "2     334.56   2.96     -  1585993  3798255024.0  218.26  1174284861   \n",
       "3     277.06   7.04     -   887301  1305800336.0   133.0   474009426   \n",
       "4      83.84   4.15     -   272641   346817120.0  119.82   422273164   \n",
       "..       ...    ...   ...      ...           ...     ...         ...   \n",
       "390    29.91   0.47     -   168709   326018848.0  197.36  1063693010   \n",
       "391    35.58    2.0     -   196375   375750768.0   192.0  1008366222   \n",
       "392   143.32   0.72     -   175893   452796304.0  263.83   307086749   \n",
       "393   426.86   0.36     -   693261  3032643232.0   455.0   696810974   \n",
       "394   323.13   0.22     -   133317   261546032.0   205.4    79660753   \n",
       "\n",
       "           流通市值  \n",
       "0     443443594  \n",
       "1     363794813  \n",
       "2    1174284861  \n",
       "3     474009426  \n",
       "4     422273164  \n",
       "..          ...  \n",
       "390  1063693010  \n",
       "391  1008366222  \n",
       "392   307086749  \n",
       "393   696810974  \n",
       "394    79660753  \n",
       "\n",
       "[395 rows x 17 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ef.bond.get_realtime_quotes()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 股票最新交易日单子流入情况(分钟级)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>股票名称</th>\n",
       "      <th>股票代码</th>\n",
       "      <th>时间</th>\n",
       "      <th>主力净流入</th>\n",
       "      <th>小单净流入</th>\n",
       "      <th>中单净流入</th>\n",
       "      <th>大单净流入</th>\n",
       "      <th>超大单净流入</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 09:31</td>\n",
       "      <td>-1936532.0</td>\n",
       "      <td>-220142.0</td>\n",
       "      <td>2156676.0</td>\n",
       "      <td>918126.0</td>\n",
       "      <td>-2854658.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 09:32</td>\n",
       "      <td>12585105.0</td>\n",
       "      <td>-165824.0</td>\n",
       "      <td>-12419280.0</td>\n",
       "      <td>5364047.0</td>\n",
       "      <td>7221058.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 09:33</td>\n",
       "      <td>17746978.0</td>\n",
       "      <td>-165824.0</td>\n",
       "      <td>-17581153.0</td>\n",
       "      <td>8939586.0</td>\n",
       "      <td>8807392.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 09:34</td>\n",
       "      <td>8318864.0</td>\n",
       "      <td>-165824.0</td>\n",
       "      <td>-8153040.0</td>\n",
       "      <td>8263001.0</td>\n",
       "      <td>55863.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 09:35</td>\n",
       "      <td>10861813.0</td>\n",
       "      <td>-165824.0</td>\n",
       "      <td>-10695988.0</td>\n",
       "      <td>7922355.0</td>\n",
       "      <td>2939458.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>235</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 14:56</td>\n",
       "      <td>-253205621.0</td>\n",
       "      <td>-2649921.0</td>\n",
       "      <td>255855550.0</td>\n",
       "      <td>66573676.0</td>\n",
       "      <td>-319779297.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>236</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 14:57</td>\n",
       "      <td>-257442835.0</td>\n",
       "      <td>-2728130.0</td>\n",
       "      <td>260170973.0</td>\n",
       "      <td>68687165.0</td>\n",
       "      <td>-326130000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>237</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 14:58</td>\n",
       "      <td>-256422748.0</td>\n",
       "      <td>-2728130.0</td>\n",
       "      <td>259150886.0</td>\n",
       "      <td>68347084.0</td>\n",
       "      <td>-324769832.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>238</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 14:59</td>\n",
       "      <td>-256422748.0</td>\n",
       "      <td>-2728130.0</td>\n",
       "      <td>259150886.0</td>\n",
       "      <td>68347084.0</td>\n",
       "      <td>-324769832.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>239</th>\n",
       "      <td>贵州茅台</td>\n",
       "      <td>600519</td>\n",
       "      <td>2021-08-13 15:00</td>\n",
       "      <td>-256422748.0</td>\n",
       "      <td>-2728130.0</td>\n",
       "      <td>259150886.0</td>\n",
       "      <td>68347084.0</td>\n",
       "      <td>-324769832.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>240 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     股票名称    股票代码                时间        主力净流入      小单净流入        中单净流入  \\\n",
       "0    贵州茅台  600519  2021-08-13 09:31   -1936532.0  -220142.0    2156676.0   \n",
       "1    贵州茅台  600519  2021-08-13 09:32   12585105.0  -165824.0  -12419280.0   \n",
       "2    贵州茅台  600519  2021-08-13 09:33   17746978.0  -165824.0  -17581153.0   \n",
       "3    贵州茅台  600519  2021-08-13 09:34    8318864.0  -165824.0   -8153040.0   \n",
       "4    贵州茅台  600519  2021-08-13 09:35   10861813.0  -165824.0  -10695988.0   \n",
       "..    ...     ...               ...          ...        ...          ...   \n",
       "235  贵州茅台  600519  2021-08-13 14:56 -253205621.0 -2649921.0  255855550.0   \n",
       "236  贵州茅台  600519  2021-08-13 14:57 -257442835.0 -2728130.0  260170973.0   \n",
       "237  贵州茅台  600519  2021-08-13 14:58 -256422748.0 -2728130.0  259150886.0   \n",
       "238  贵州茅台  600519  2021-08-13 14:59 -256422748.0 -2728130.0  259150886.0   \n",
       "239  贵州茅台  600519  2021-08-13 15:00 -256422748.0 -2728130.0  259150886.0   \n",
       "\n",
       "          大单净流入       超大单净流入  \n",
       "0      918126.0   -2854658.0  \n",
       "1     5364047.0    7221058.0  \n",
       "2     8939586.0    8807392.0  \n",
       "3     8263001.0      55863.0  \n",
       "4     7922355.0    2939458.0  \n",
       "..          ...          ...  \n",
       "235  66573676.0 -319779297.0  \n",
       "236  68687165.0 -326130000.0  \n",
       "237  68347084.0 -324769832.0  \n",
       "238  68347084.0 -324769832.0  \n",
       "239  68347084.0 -324769832.0  \n",
       "\n",
       "[240 rows x 8 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import efinance as ef\n",
    "ef.stock.get_today_bill('600519')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 债券历史交易日单子流入情况(日级)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>股票名称</th>\n",
       "      <th>股票代码</th>\n",
       "      <th>日期</th>\n",
       "      <th>主力净流入</th>\n",
       "      <th>小单净流入</th>\n",
       "      <th>中单净流入</th>\n",
       "      <th>大单净流入</th>\n",
       "      <th>超大单净流入</th>\n",
       "      <th>主力净流入占比</th>\n",
       "      <th>小单流入净占比</th>\n",
       "      <th>中单流入净占比</th>\n",
       "      <th>大单流入净占比</th>\n",
       "      <th>超大单流入净占比</th>\n",
       "      <th>收盘价</th>\n",
       "      <th>涨跌幅</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-23</td>\n",
       "      <td>8.429079e+08</td>\n",
       "      <td>-8.135256e+08</td>\n",
       "      <td>-29382340.0</td>\n",
       "      <td>133380.0</td>\n",
       "      <td>8.427745e+08</td>\n",
       "      <td>35.31</td>\n",
       "      <td>-34.08</td>\n",
       "      <td>-1.23</td>\n",
       "      <td>0.01</td>\n",
       "      <td>35.30</td>\n",
       "      <td>130.000</td>\n",
       "      <td>30.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-26</td>\n",
       "      <td>2.461945e+09</td>\n",
       "      <td>-2.776276e+09</td>\n",
       "      <td>314330896.0</td>\n",
       "      <td>886787984.0</td>\n",
       "      <td>1.575157e+09</td>\n",
       "      <td>21.86</td>\n",
       "      <td>-24.66</td>\n",
       "      <td>2.79</td>\n",
       "      <td>7.88</td>\n",
       "      <td>13.99</td>\n",
       "      <td>130.010</td>\n",
       "      <td>0.01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-27</td>\n",
       "      <td>3.468242e+08</td>\n",
       "      <td>-3.544359e+08</td>\n",
       "      <td>7611648.0</td>\n",
       "      <td>211297424.0</td>\n",
       "      <td>1.355268e+08</td>\n",
       "      <td>14.71</td>\n",
       "      <td>-15.03</td>\n",
       "      <td>0.32</td>\n",
       "      <td>8.96</td>\n",
       "      <td>5.75</td>\n",
       "      <td>129.600</td>\n",
       "      <td>-0.32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-28</td>\n",
       "      <td>1.175705e+08</td>\n",
       "      <td>-1.793611e+08</td>\n",
       "      <td>61790576.0</td>\n",
       "      <td>40961152.0</td>\n",
       "      <td>7.660938e+07</td>\n",
       "      <td>6.12</td>\n",
       "      <td>-9.33</td>\n",
       "      <td>3.22</td>\n",
       "      <td>2.13</td>\n",
       "      <td>3.99</td>\n",
       "      <td>130.770</td>\n",
       "      <td>0.90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-04-29</td>\n",
       "      <td>9.919188e+07</td>\n",
       "      <td>-1.130380e+08</td>\n",
       "      <td>13846176.0</td>\n",
       "      <td>-3483472.0</td>\n",
       "      <td>1.026753e+08</td>\n",
       "      <td>6.50</td>\n",
       "      <td>-7.41</td>\n",
       "      <td>0.91</td>\n",
       "      <td>-0.23</td>\n",
       "      <td>6.73</td>\n",
       "      <td>131.208</td>\n",
       "      <td>0.33</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>72</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-09</td>\n",
       "      <td>-2.804743e+07</td>\n",
       "      <td>2.833411e+07</td>\n",
       "      <td>-286672.0</td>\n",
       "      <td>-21161398.0</td>\n",
       "      <td>-6.886029e+06</td>\n",
       "      <td>-2.93</td>\n",
       "      <td>2.96</td>\n",
       "      <td>-0.03</td>\n",
       "      <td>-2.21</td>\n",
       "      <td>-0.72</td>\n",
       "      <td>159.300</td>\n",
       "      <td>-0.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>73</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-10</td>\n",
       "      <td>2.417333e+07</td>\n",
       "      <td>-3.111051e+06</td>\n",
       "      <td>-21062288.0</td>\n",
       "      <td>2356749.0</td>\n",
       "      <td>2.181658e+07</td>\n",
       "      <td>2.94</td>\n",
       "      <td>-0.38</td>\n",
       "      <td>-2.56</td>\n",
       "      <td>0.29</td>\n",
       "      <td>2.65</td>\n",
       "      <td>160.950</td>\n",
       "      <td>1.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-11</td>\n",
       "      <td>-5.211132e+06</td>\n",
       "      <td>6.582865e+06</td>\n",
       "      <td>-1371732.0</td>\n",
       "      <td>-15001575.0</td>\n",
       "      <td>9.790443e+06</td>\n",
       "      <td>-1.09</td>\n",
       "      <td>1.37</td>\n",
       "      <td>-0.29</td>\n",
       "      <td>-3.12</td>\n",
       "      <td>2.04</td>\n",
       "      <td>159.850</td>\n",
       "      <td>-0.68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-12</td>\n",
       "      <td>1.015957e+07</td>\n",
       "      <td>1.342899e+07</td>\n",
       "      <td>-23588553.0</td>\n",
       "      <td>-16521807.0</td>\n",
       "      <td>2.668137e+07</td>\n",
       "      <td>2.36</td>\n",
       "      <td>3.12</td>\n",
       "      <td>-5.49</td>\n",
       "      <td>-3.84</td>\n",
       "      <td>6.21</td>\n",
       "      <td>158.290</td>\n",
       "      <td>-0.98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>东财转3</td>\n",
       "      <td>123111</td>\n",
       "      <td>2021-08-13</td>\n",
       "      <td>5.503683e+06</td>\n",
       "      <td>-1.872510e+05</td>\n",
       "      <td>-5316431.0</td>\n",
       "      <td>11757638.0</td>\n",
       "      <td>-6.253955e+06</td>\n",
       "      <td>1.38</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>-1.34</td>\n",
       "      <td>2.96</td>\n",
       "      <td>-1.57</td>\n",
       "      <td>158.358</td>\n",
       "      <td>0.04</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>77 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    股票名称    股票代码          日期         主力净流入         小单净流入        中单净流入  \\\n",
       "0   东财转3  123111  2021-04-23  8.429079e+08 -8.135256e+08  -29382340.0   \n",
       "1   东财转3  123111  2021-04-26  2.461945e+09 -2.776276e+09  314330896.0   \n",
       "2   东财转3  123111  2021-04-27  3.468242e+08 -3.544359e+08    7611648.0   \n",
       "3   东财转3  123111  2021-04-28  1.175705e+08 -1.793611e+08   61790576.0   \n",
       "4   东财转3  123111  2021-04-29  9.919188e+07 -1.130380e+08   13846176.0   \n",
       "..   ...     ...         ...           ...           ...          ...   \n",
       "72  东财转3  123111  2021-08-09 -2.804743e+07  2.833411e+07    -286672.0   \n",
       "73  东财转3  123111  2021-08-10  2.417333e+07 -3.111051e+06  -21062288.0   \n",
       "74  东财转3  123111  2021-08-11 -5.211132e+06  6.582865e+06   -1371732.0   \n",
       "75  东财转3  123111  2021-08-12  1.015957e+07  1.342899e+07  -23588553.0   \n",
       "76  东财转3  123111  2021-08-13  5.503683e+06 -1.872510e+05   -5316431.0   \n",
       "\n",
       "          大单净流入        超大单净流入  主力净流入占比  小单流入净占比  中单流入净占比  大单流入净占比  超大单流入净占比  \\\n",
       "0      133380.0  8.427745e+08    35.31   -34.08    -1.23     0.01     35.30   \n",
       "1   886787984.0  1.575157e+09    21.86   -24.66     2.79     7.88     13.99   \n",
       "2   211297424.0  1.355268e+08    14.71   -15.03     0.32     8.96      5.75   \n",
       "3    40961152.0  7.660938e+07     6.12    -9.33     3.22     2.13      3.99   \n",
       "4    -3483472.0  1.026753e+08     6.50    -7.41     0.91    -0.23      6.73   \n",
       "..          ...           ...      ...      ...      ...      ...       ...   \n",
       "72  -21161398.0 -6.886029e+06    -2.93     2.96    -0.03    -2.21     -0.72   \n",
       "73    2356749.0  2.181658e+07     2.94    -0.38    -2.56     0.29      2.65   \n",
       "74  -15001575.0  9.790443e+06    -1.09     1.37    -0.29    -3.12      2.04   \n",
       "75  -16521807.0  2.668137e+07     2.36     3.12    -5.49    -3.84      6.21   \n",
       "76   11757638.0 -6.253955e+06     1.38    -0.05    -1.34     2.96     -1.57   \n",
       "\n",
       "        收盘价    涨跌幅  \n",
       "0   130.000  30.00  \n",
       "1   130.010   0.01  \n",
       "2   129.600  -0.32  \n",
       "3   130.770   0.90  \n",
       "4   131.208   0.33  \n",
       "..      ...    ...  \n",
       "72  159.300  -0.34  \n",
       "73  160.950   1.04  \n",
       "74  159.850  -0.68  \n",
       "75  158.290  -0.98  \n",
       "76  158.358   0.04  \n",
       "\n",
       "[77 rows x 15 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import efinance as ef\n",
    "ef.stock.get_history_bill('123111')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 更多使用例子详见文档 [efinance-docs](https://efinance.readthedocs.io/)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.10 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "metadata": {
   "interpreter": {
    "hash": "2869ce9e5406e14300c007bd85d712496dadc3f6ad6dbd3a9c900289863a5f83"
   }
  },
  "orig_nbformat": 2,
  "vscode": {
   "interpreter": {
    "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
